<?php
class property extends ujn_controller {
	var $auto_render = false;
	
	public function lists() {
		$data = array(
			'flag' => 1,
			'lists' => mdl_global_property::getInstance()->getAll(),
		);
		echo json_encode( $data );
	}
	
	public function get(){
		$data = array(
			'flag' => 1,
			'lists' => mdl_global_property::getInstance()->getOne( $_POST['proid'] ),
		);
		echo json_encode($data);
	}
	
	public function add() {
		$data = array(
			'flag' => mdl_global_property::getInstance()->edit(
						$_POST['name'], $_POST['type'], $_POST['price'], $_POST['sort'], $_POST['file'],	$_POST['currency'], $_POST['desc'], $_POST['status'], $_POST['name_th'])
		);
		echo json_encode( $data );
	}
	
	public function edit() {
		$data = array(
			'flag' => mdl_global_property::getInstance()->edit(filterPost( $_POST )) 
		);
		echo json_encode( $data );							
	}
}